package com.lagou.boot;

import com.alibaba.fastjson.JSONObject;
import com.lagou.client.RPCConsumer;
import com.lagou.service.IUserService;
import com.lagou.service.RpcRequest;
import io.netty.handler.codec.json.JsonObjectDecoder;

public class ConsumerBoot {

    public static void main(String[] args) throws InterruptedException {
        //1.创建代理对象
        IUserService service = (IUserService) RPCConsumer.createProxy(IUserService.class);

        //2.循环给服务器写数据
        while (true){
            RpcRequest rpcRequest = new RpcRequest();
            rpcRequest.setMethodName("sayHello");
            rpcRequest.setParameter("are you ok !!");
            String msg = JSONObject.toJSONString(rpcRequest);
            String result = service.sayHello(msg);
            System.out.println(result);
            Thread.sleep(2000);
        }

    }
}
